#ifndef __DICTC_H_
#define __DICTC_H_

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/utsname.h>

#include <netinet/in.h>
#include <net/if.h>
#include <arpa/inet.h>

#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <histedit.h>
#include <netdb.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

namespace dict {
   const u_int16_t DictPort = 2628;
   const u_int32_t CmdLineLen = 1024;
   const u_int32_t CmdLineBuf = 8192;
   const u_int32_t MaxCmdLine = CmdLineLen - 2;
   const u_int32_t MaxLine = 4096;
   const u_int32_t MaxSleep = 1;
   const u_int32_t MaxToken = 7;
   const u_int32_t MaxHistory = 100;

   class dictClient {
      public:
         dictClient ();
         dictClient (const dictClient &);
         dictClient &operator= (const dictClient &);
         ~dictClient ();

         void Connect (const char *, const u_int16_t, const int);
         void Close (void);
         void sockRead (char *);
         void sockWrite (const char *);
         void nonBlock (void);
         void unBlock (void);

      private:
         int __af;
         int __sock;
         u_int16_t __port;

         char *__server;
         struct sockaddr_in __sin4;
         struct sockaddr_in6 __sin6;

   };


   class cmdLineEdit {
      public:
         cmdLineEdit ();
         cmdLineEdit (const cmdLineEdit &);
         cmdLineEdit &operator= (const cmdLineEdit &);
         ~cmdLineEdit ();

         void cmdPrompt (void);
         void parseCmds (char *);
         void printHistory (void);

      private:
         EditLine *__edit;
         History *__hist;
         HistEvent __histEvent;
   };
}

#endif
